# -*- coding: utf-8 -*-
#Importamos librerias standars
import datetime
from datetime import timedelta
from django import forms
from django.forms import ModelForm
from django.contrib.admin import widgets
from django.forms.models import modelformset_factory
from django.forms.extras.widgets import SelectDateWidget

#Librerias realizadas por nosotros
from mundofacu.usuarios.models import carreras
from models import noticias, comentarios

#Definicion de formularios de trabajo
class Fnew(ModelForm):
	titulo = forms.CharField(label='Titulo', widget=forms.TextInput(attrs={'size':35}))
	resumen = forms.CharField(label="Resumen", widget=forms.Textarea(attrs={'style':'width: 450px; height: 100px'}))
	body = forms.CharField(label="Cuerpo", widget=forms.Textarea(attrs={'style':'width: 450px; height: 350px'}))
	fecha_publicacion= forms.DateField(label="Publicacion",initial=datetime.date.today(), widget= SelectDateWidget(years=range(datetime.date.today().year,datetime.date.today().year+1,1))) #Si lo deseamos podemos sobreescribir un campo :D
	fecha_expiracion= forms.DateField(label="Expiracion", initial=datetime.date.today() + timedelta(days=+7), widget= SelectDateWidget(years=range(datetime.date.today().year,datetime.date.today().year+1,1))) #Si lo deseamos podemos sobreescribir un campo :D
	class Meta:
		model = noticias
		fields = ["titulo","carrera","body","resumen","fecha_publicacion","fecha_expiracion"]
		exclude = ['autor', 'fecha_creacion', 'estado', 'puntaje']


class Fcomentario(forms.Form):
	texto = forms.CharField(label="", widget=forms.Textarea(attrs={'style':'width: 450px; height: 80px'}))


class Fcarrera(ModelForm):
	class Meta:
		model = carreras
		exclude = ["activo"]